<?php

namespace Beerus\Modules\BizProject\Controllers;

use App\Http\Controllers\Controller;
use Biz\service\activity\project\BizProjectParseTpl as tpl;
use Encore\Admin\Layout\Content;
use Exception;
use Illuminate\Http\Request;

class BizProjectController extends Controller
{

    /**
     * @throws Exception
     */
    public function pList(Content $content, Request $request, $module = '', $pid = 0): Content
    {
        return $this->list($content, $request, $module, $pid);
    }

    /**
     * @throws Exception
     */
    public function list(Content $content, Request $request, $module = '', $pid = 0): Content
    {
        return tpl::getInstance($module, $request)->listDisplay($content, $pid);
    }

    /**
     * @throws Exception
     */
    public function pCreate(Request $request, Content $content, $module = '', $pid = 0, $id = 0): Content
    {
        return $this->create($request, $content, $module, $id, $pid);
    }

    /**
     * @throws Exception
     */
    public function create(Request $request, Content $content, $module = '', $id = 0, $pid = 0): Content
    {
        return tpl::getInstance($module, $request)->createDisplay($content, $pid, $id);
    }

    /**
     * @throws Exception
     */
    public function pSave(Request $request, $module = '', $pid = 0)
    {
        return $this->save($request, $module, $pid);
    }

    /**
     * @throws Exception
     */
    public function save(Request $request, $module = '', $pid = 0)
    {
        return tpl::getInstance($module, $request)->saveApi($pid);
    }

    /**
     * @throws Exception
     */
    public function pDelete(Request $request, $module = '', $pid = 0, $id = 0): \Illuminate\Http\JsonResponse
    {
        return $this->delete($request, $module, $id, $pid);
    }

    /**
     * @throws Exception
     */
    public function delete(Request $request, $module = '', $id = 0, $pid = 0): \Illuminate\Http\JsonResponse
    {
        return tpl::getInstance($module, $request)->deleteApi($pid, $id);
    }

    /**
     * @throws Exception
     */
    public function pExport(Request $request, Content $content, $module = '', $pid = 0)
    {
        $this->export($request, $content, $module, $pid);
    }

    /**
     * @throws Exception
     */
    public function export(Request $request, Content $content, $module = '', $pid = 0)
    {
        tpl::getInstance($module, $request)->exportDisplay($pid);
    }

    /**
     * @throws Exception
     */
    public function pSort(Request $request, $module = '', $pid = 0)
    {
        $this->sort($request, $module, $pid);
    }

    /**
     * @throws Exception
     */
    public function sort(Request $request, $module = '', $pid = 0)
    {
        tpl::getInstance($module, $request)->sortApi($pid);
    }

    /**
     * @throws Exception
     */
    public function pPut(Request $request, $module = '', $id = 0, $pid = 0)
    {
        return $this->put($request, $module, $id, $pid);
    }

    /**
     * @throws Exception
     */
    public function put(Request $request, $module = '', $id = 0, $pid = 0): \Illuminate\Http\JsonResponse
    {
        return tpl::getInstance($module, $request)->putApi($pid, $id);
    }
}